package com.itheima.mm.controller;
import com.itheima.mm.entity.Result;
import com.itheima.mm.pojo.Dict;
import com.itheima.mm.service.IDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * 包名:com.itheima.mm.controller
 * 作者:Leevi
 * 日期2020-01-16  10:25
 */
@RestController
@RequestMapping("dict")
public class DictController {
    @Autowired
    private IDictService dictService ;
    @RequestMapping("findAll")
    public Result findAll() throws IOException {
        try {
            List<Dict> dictList = dictService.findAll();
            //获取城市列表成功
            return new Result(true,"获取城市列表成功",dictList);
        } catch (Exception e) {
            e.printStackTrace();
            //获取城市列表失败
            return new Result(false,"获取城市列表失败");

        }
    }
}
